package com.bnyy.message.enums;

import com.bnyy.message.R;

/**
 * Author : 关炳鹏
 * Description :
 * Date : 2022/12/1
 **/
public enum ChatType {

    PRIVATE_CHAT(0, "私聊"),
    GROUP_CHAT(1, "群聊"),
    VERIFICATION(2, "验证消息", R.mipmap.icon_message_verification),
    STRANGER(3, "陌生人消息", R.mipmap.icon_message_stranger),
    NOTICE_NEW_FANS(MessageType.NOTICE_NEW_FANS, R.mipmap.icon_message_new_fans),
    NOTICE_ALARM(MessageType.NOTICE_ALARM, R.mipmap.icon_message_notice_alarm),
    NOTICE_LOCATION_AUTHORITY(MessageType.NOTICE_LOCATION_AUTHORITY, R.mipmap.icon_message_notice_location_authority),
    NOTICE_GOODS(MessageType.NOTICE_GOODS, R.mipmap.icon_message_notice_goods);

    private int type;
    private String name;
    private int header;
    private String chatId;

    ChatType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    ChatType(MessageType messageType, int header) {
        this.type = messageType.getType();
        this.name = messageType.getName();
        this.header = header;
    }

    ChatType(int type, String name, int header) {
        this.type = type;
        this.name = name;
        this.header = header;
    }

    public String getName() {
        return name;
    }

    public int getHeader() {
        return header;
    }

    public String getChatId() {
        return chatId;
    }

    public void setChatId(String chatId) {
        this.chatId = chatId;
    }

    public int getType() {
        return type;
    }

    /**
     * 获取会话列表类型
     *
     * @return
     */
    public static ChatType getChatType(int chatType) {
        for (ChatType c : ChatType.values()) {
            if (c.type == chatType) {
                return c;
            }
        }
        return null;
    }
}
